<?php
require_once ("../db/connectdatabase.php");
require_once ("../entitys/InstallmentRate.php");

function insertInstallmentRate($value) {
	$con = new ConnectDB();
	
	$tbl = "installmentrate";
	$fn = array('rate_id' => ($value -> getID()), 'bankid' => ($value -> getBank()), 'bankname' => ($value -> getBankName()), 'banklogo' => ($value -> getBankLogo()), 'cata' => ($value -> getCatA()), 'catb' => ($value -> getCatB()), 'others' => ($value -> getOther()), 'prepaymentcharge' => ($value -> getPrepaymentCharge()), 'processfee' => ($value -> getProcessfee()), 'dateupdate' => ($value -> getDatecreate()));
	return $con -> insert($tbl, $fn);
}

function updateInstallmentRate($value) {
	$con = new ConnectDB();
	
	$tbl = "installmentrate";
	$fn = array('bankid' => ($value -> getBank()), 'bankname' => ($value -> getBankName()), 'banklogo' => ($value -> getBankLogo()), 'cata' => ($value -> getCatA()), 'catb' => ($value -> getCatB()), 'others' => ($value -> getOther()), 'prepaymentcharge' => ($value -> getPrepaymentCharge()), 'processfee' => ($value -> getProcessfee()), 'dateupdate' => ($value -> getDatecreate()));
	$condition = array('rate_id' => ($value -> getID()));
	return $con -> update($tbl, $fn, $condition);
}

function deleteInstallmentRate($id) {
	$con = new ConnectDB();
	
	$tbl = "installmentrate";
	$fn = array('isuse' => false);
	$condition = array('rate_id' => $id);
	return $con -> update($tbl, $fn, $condition);
}

function deleteInstallmentRateArray($arrid) {
	$con = new ConnectDB();
	
	$tbl = "installmentrate";
	$fn = array('isuse' => false);
	$idrowdel = "rate_id";
	$condition = $arrid;
	return $con -> updatedels($tbl, $fn, $idrowdel, $condition);
}

?>